package stc.skymobi.netty.util;

import java.util.HashMap;
import java.util.Map;
import java.util.List;

import com.google.common.collect.Lists;

public class StringUtils {

    public static Map stringToMap(String value) {
        Map map = new HashMap();
        if (value == null)
            return map;
        for (String s : value.split(",")) {
            String[] m = s.split(":");
            if (m.length == 2)
                map.put(m[0].trim(), m[1].trim());
        }

        return map;
    }
    
    public static List<String> stringToList(String value) {
        if (value == null) {
            return Lists.newArrayList();
        }
        return Lists.newArrayList(value.split(","));
    }
}
